//
//  LYSelectedClassInfoTableViewCell.m
//  artist
//
//  Created by laotang on 16/5/1.
//  Copyright © 2016年 viviyoo. All rights reserved.
//

#import "LYSelectedClassInfoTableViewCell.h"

#import <Masonry.h>

@implementation LYSelectedClassInfoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.placeHoldImageView.backgroundColor = [UIColor whiteColor];
    self.placeHoldImageView.contentMode = UIViewContentModeScaleToFill;
    WS(weakSelf)
    self.placeHoldImageView.hidden = YES;
    self.placeHoldImageView.layer.cornerRadius = 25;
    self.placeHoldImageView.layer.borderColor = [UIColor whiteColor].CGColor;
    self.placeHoldImageView.layer.borderWidth = 2;
    self.placeHoldImageView.layer.masksToBounds = YES;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setSelectModel:(LYSelectedStudentViewSelectModel *)selectModel{
    _selectModel = selectModel;
    
    if(selectModel.selectArray.count){
        self.textFeild.userInteractionEnabled = NO;
    }else{
        self.textFeild.userInteractionEnabled = YES;
    }
    self.titleLabel.text = selectModel.title;
    self.textFeild.placeholder = selectModel.placeHold;
    self.textFeild.text = selectModel.originProperty;
    if ([selectModel.title isEqualToString:@"哪里的呀"]){
        self.textFeild.userInteractionEnabled = NO;

    }
    
    if ([selectModel.title containsString:@"教育方向"] ||
        [selectModel.title containsString:@"艺考方向"] ||
        [selectModel.title containsString:@"培训方向"]){
        self.textFeild.userInteractionEnabled = NO;
    }
    
    if ([selectModel.title isEqualToString:@"头像"]){
        
        NSLog(@"%@", selectModel.originProperty);
        
        [self.placeHoldImageView sd_setImageWithURL:[NSURL URLWithString:selectModel.originProperty]];
        self.textFeild.hidden = YES;
        self.placeHoldImageView.hidden = NO;
    }
    if ([selectModel.title isEqualToString:@"性别"]){
        
        if ([selectModel.originProperty isEqualToString:@"1"]){
            self.textFeild.text = @"男";

        }else{
            self.textFeild.text = @"女";

        }

    }

}
@end


@implementation LYSelectedStudentViewSelectModel

+ (instancetype)setTitle:(NSString *)title palceHold:(NSString *)placeHold selectedArray:(NSArray *)selectArray originProperty:(NSString *)originProperty{
    
    LYSelectedStudentViewSelectModel * model  = [[self alloc] init];
    if(model){
        
        
        model.title = title;
        model.placeHold = placeHold;
        model.selectArray = selectArray;
        model.originProperty = originProperty;
        NSLog(@"%@======================%@", model.title, model.originProperty);

    }
    return model;
}


@end
